- Posts: 8
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to hide/display part of question text based on {TOKEN/LASTNAME} ?
- laura.bonacini
- Topic Author
- Offline
- New Member
Less
More
1 year 10 months ago - 1 year 10 months ago #229723
by laura.bonacini
How to hide/display part of question text based on {TOKEN/LASTNAME} ? was created by laura.bonacini
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.22.24+200630
Own server or LimeSurvey hosting: don't know
Survey theme/template: fruity / inherit
==================
Hello
How to hide/display part of question text based on {TOKEN/LASTNAME}?
A part (see screenshot) of question text => for all {TOKEN/LASTNAME} in my relevance equation:
(((TOKEN:LASTNAME == "BCFR")) or
(((TOKEN:LASTNAME == "BRBDR")) or
((TOKEN:LASTNAME == "CRRD")) or
((TOKEN:LASTNAME == "IQECAD")) or
((TOKEN:LASTNAME == "IQED")) or
((TOKEN:LASTNAME == "IQEDFOOT")) or
((TOKEN:LASTNAME == "NSIH_CDIF")) or
((TOKEN:LASTNAME == "NSIH_SEP")))
B part only if {TOKEN/LASTNAME} in
(((TOKEN:LASTNAME == "BCFR")) or
((TOKEN:LASTNAME == "BRBDR")) or
((TOKEN:LASTNAME == "CRRD")) or
((TOKEN:LASTNAME == "IQECAD")) or
((TOKEN:LASTNAME == "IQED")) or
((TOKEN:LASTNAME == "IQEDFOOT")))
Could you let me know where to code in the question text this logic ?
Thanks in advance
Laura
Your LimeSurvey version: Version 3.22.24+200630
Own server or LimeSurvey hosting: don't know
Survey theme/template: fruity / inherit
==================
Hello
How to hide/display part of question text based on {TOKEN/LASTNAME}?
A part (see screenshot) of question text => for all {TOKEN/LASTNAME} in my relevance equation:
(((TOKEN:LASTNAME == "BCFR")) or
(((TOKEN:LASTNAME == "BRBDR")) or
((TOKEN:LASTNAME == "CRRD")) or
((TOKEN:LASTNAME == "IQECAD")) or
((TOKEN:LASTNAME == "IQED")) or
((TOKEN:LASTNAME == "IQEDFOOT")) or
((TOKEN:LASTNAME == "NSIH_CDIF")) or
((TOKEN:LASTNAME == "NSIH_SEP")))
B part only if {TOKEN/LASTNAME} in
(((TOKEN:LASTNAME == "BCFR")) or
((TOKEN:LASTNAME == "BRBDR")) or
((TOKEN:LASTNAME == "CRRD")) or
((TOKEN:LASTNAME == "IQECAD")) or
((TOKEN:LASTNAME == "IQED")) or
((TOKEN:LASTNAME == "IQEDFOOT")))
Could you let me know where to code in the question text this logic ?
Thanks in advance
Laura
Attachments:
Last edit: 1 year 10 months ago by laura.bonacini.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10116
- Thank you received: 3597
1 year 10 months ago #229724
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic How to hide/display part of question text based on {TOKEN/LASTNAME} ?
Please refer to the manual -
manual.limesurvey.org/ExpressionScript_H...BINSERTANS:xxx.7D.29
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- laura.bonacini
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
1 year 10 months ago - 1 year 10 months ago #229730
by laura.bonacini
Replied by laura.bonacini on topic How to hide/display part of question text based on {TOKEN/LASTNAME} ?
How to combine multi-test in a if function on LS ?
The following code is not working:
if( (((TOKEN:LASTNAME == "NSIH_SEP")) or ((TOKEN:LASTNAME == "NSIH_CDIF"))), "" , "B part")
The question is exclude when TOKEN:LASTNAME == "NSIH_SEP" or == "NSIH_CDIF".
Can someone help me out with this ?
Many thanks
The following code is not working:
if( (((TOKEN:LASTNAME == "NSIH_SEP")) or ((TOKEN:LASTNAME == "NSIH_CDIF"))), "" , "B part")
The question is exclude when TOKEN:LASTNAME == "NSIH_SEP" or == "NSIH_CDIF".
Can someone help me out with this ?
Many thanks
Last edit: 1 year 10 months ago by laura.bonacini.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12997
- Thank you received: 3999
1 year 10 months ago - 1 year 10 months ago #229731
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to hide/display part of question text based on {TOKEN/LASTNAME} ?
Hi, Laura,
the buzzword is "Tayloring".
As shown here
[url] manual.limesurvey.org/ExpressionScript_H...7BMrs.7D_Smith....22 [/url]
Gender has to be replaced by TOKEN:LASTNAME and Mr. resp. Mrs. by your texts
Your question (without your orgy of brackets)
{if(TOKEN:LASTNAME == "NSIH_SEP" or TOKEN:LASTNAME == "NSIH_CDIF", "" , "B part")}
You see that the equations will get very long.
Why don't you add a TOKEN:ATTRIBUTE where all Lastnames who are to see part A, get a "1", Lastnames who are to see B, get a "2".
Then your IF is only
{if(TOKEN_ATTRIBUTE_1=="1","Text A",if(TOKEN_ATTRIBUTE_1=="2","Text B".""))}
Joffm
I wrote the first part before Tony answered.
Anyway: You should always send a lss export of these relevant questions.
Many times there is only a small typo, and we write and write and write without noticing it.
the buzzword is "Tayloring".
As shown here
[url] manual.limesurvey.org/ExpressionScript_H...7BMrs.7D_Smith....22 [/url]
Gender has to be replaced by TOKEN:LASTNAME and Mr. resp. Mrs. by your texts
Your question (without your orgy of brackets)
{if(TOKEN:LASTNAME == "NSIH_SEP" or TOKEN:LASTNAME == "NSIH_CDIF", "" , "B part")}
You see that the equations will get very long.
Why don't you add a TOKEN:ATTRIBUTE where all Lastnames who are to see part A, get a "1", Lastnames who are to see B, get a "2".
Then your IF is only
{if(TOKEN_ATTRIBUTE_1=="1","Text A",if(TOKEN_ATTRIBUTE_1=="2","Text B".""))}
Joffm
I wrote the first part before Tony answered.
Anyway: You should always send a lss export of these relevant questions.
Many times there is only a small typo, and we write and write and write without noticing it.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 10 months ago by Joffm.
The following user(s) said Thank You: laura.bonacini
Please Log in to join the conversation.
- laura.bonacini
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
1 year 10 months ago #229733
by laura.bonacini
Replied by laura.bonacini on topic How to hide/display part of question text based on {TOKEN/LASTNAME} ?
Hi Joffm
It worked! Many thanks.
I read somewhere that we need to use double brackets when using OR operator. This is why there were so many brackets in my inital code.
Best regards
Laura
It worked! Many thanks.
I read somewhere that we need to use double brackets when using OR operator. This is why there were so many brackets in my inital code.
Best regards
Laura
Please Log in to join the conversation.